﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="left-managements.aspx.cs" Inherits="Mocola.Net.Web.left_managements" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>CsLand Ams v1.0 - 中新置地档案管理系统</title>
    <meta name="description" content="CsLand Ams v1.0 - 中新置地档案管理系统" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />

    <link rel="stylesheet" href="css/content.css" type="text/css" />
    <link rel="stylesheet" href="css/ui.css" type="text/css" />
    <link rel="stylesheet" href="css/sys.css" type="text/css" />
    <link rel="stylesheet" href="css/dtree.css" type="text/css" />
    
    <!--[if IE]>
	    <script type="text/javascript" src="scripts/excanvas-compressed.js"></script>	
	    <style type="text/css"> html{ height: 100%; overflow: auto; } </style>	
    <![endif]-->
    	
    <script type="text/javascript" src="scripts/mootools-1.2-core.js"></script>
    <script type="text/javascript" src="scripts/mootools-1.2-more.js"></script>	
    <script type="text/javascript" src="scripts/mocha.js"></script>
    <script type="text/javascript" src="scripts/dtree.js"></script>
    <script type="text/javascript" src="scripts/mocola-funs.js"></script>
</head>
<body oncontextmenu="return false">
    <form id="form1" runat="server">
    <%if (RoleId == 1) {%>
    <div id="rmenu" class="lmenu" >
        <div class="itemnew"><a id="rmenu_1">新建目录</a></div>     
    </div>
    <div id="rmenu2" class="lmenu">
        <div class="itemnew"><a id="rmenu2_1">新建目录</a></div>
        <div class="itemnew"><a id="del2_1">删除目录</a></div>
    </div>
    <%} %>
    <div style="padding:10px;">
        <div id="mytree">
        <script type="text/javascript">
        <!--
        function op(id,p1,p2,p3,p4,p5) {
	        	    <%if (RoleId == 1) {%>
            $(id).addEvent('mouseup', function(e){showmenu(p1,p2,p3,p4,p5);});
             <%} %>
            $(id).href=p5==1?'javascript:editproject('+p4+');':(p5==3?'javascript:newmapfile('+p1+','+p4+')':'#');           
        }
        
        var d = new dTree('d');
	    <%= TreesStirng %>
	    document.write(d);
	    <%= TreesScriptsStirng %>

        var tree;

        function find_node() {
	        var node = tree.get( $('nodeid_input').value );
	        window.alert( node ? 'found: ' + node.text : 'not found...' );
        }
        -->
        </script>
    </div>
    </form>
    <script type="text/javascript">
        
	    if ( !MochaUI.treeScript == true ){
	        new Request({
		        url: '../plugins/tree/scripts/tree.js',
		        method: 'get',
		        onSuccess: function() {
			        buildTree('tree1');
			        MochaUI.treeScript = true;
		        }.bind(this)
	        }).send();
        }
        
        <%if (RoleId == 1) {%>
        $('rmenu').addEvent('blur', function(){
            $('rmenu').style.display = 'none';
        });
        $('rmenu2').addEvent('blur', function(){
            $('rmenu2').style.display = 'none';
        });

        /*Begin:[#19]*/
        function showmenu(UniqueID,Name,ParentID,ExtId,ListType) {
            if(isRight()) {
                var bowserEvent = (document.all) ? event : arguments.callee.caller.arguments[0];
		        var myEvent = new Event( bowserEvent );

                if(ListType==0) {
                    $('rmenu').style.top = myEvent.page.y + 'px';
                    $('rmenu').style.left = myEvent.page.x + 'px';
                    $('rmenu').style.display = 'block';
                    $('rmenu').focus(); 
                    $('rmenu_1').onclick = function() {newPhase(UniqueID,Name,ParentID,ExtId,3);}
                } else {
                    $('rmenu2_1').innerHTML='新建目录';
                    $('del2_1').innerHTML='删除目录';
                    $('rmenu2').style.top = myEvent.page.y + 'px';
                    $('rmenu2').style.left = myEvent.page.x + 'px';
                    $('rmenu2').style.display = 'block';
                    $('rmenu2').focus();
                    $('rmenu2_1').onclick = function() {newPhase(UniqueID,Name,ParentID,ExtId,3);}
                    $('del2_1').onclick=function(){return delMangement(UniqueID,ParentID,Name,ExtId);}
                }
            }
                
        }
        /*End:[#19]*/
       
       
        function isRight() {
            var bowserEvent = (document.all) ? event : arguments.callee.caller.arguments[0];
           
            if (bowserEvent.which == null)
                /* IE case */
                button= (bowserEvent.button < 2) ? "LEFT" : ((bowserEvent.button == 4) ? "MIDDLE" : "RIGHT");
            else
                /* All others */
                button= (bowserEvent.which < 2) ? "LEFT" : ((bowserEvent.which == 2) ? "MIDDLE" : "RIGHT");
   
            if (button=="RIGHT") 
                return true;
            else
                return false;
        }
        
        function newPhase(UniqueID,Name,ParentID,ExtId,Type) {
            var ptitle = Type==2?'新建阶段':'新建目录';
            new window.parent.MochaUI.Window({
                id: 'winNewPhase',
                title: ptitle,
                loadMethod: 'iframe',
                contentURL: 'NewMPhase.aspx?name='+Name+'&pid='+ParentID+'&eid='+ExtId+'&uid='+UniqueID+'&type='+Type+'&'+(new Date()).getTime(),
                width: 300,
                height: 150,
                resizable: false,
	            maximizable: false
            });
        }
        
        /*Begin:[#19]*/
        function delMangement(UniqueID,ParentID,Name,ExtId)
        {
            new window.parent.MochaUI.Window({
            id: 'delmangement',
            title: '删除确认',
            loadMethod: 'iframe',
            contentURL: 'delmanagement.aspx?name='+Name+'&eid='+ExtId+'&uid='+UniqueID+'&p='+ParentID+'&'+(new Date()).getTime(),
            width: 300,
            height: 150,
            resizable:false
            });           
        }
        <%} %>
        
        function newmapfile(p1,p4) {
            window.parent.MochaUI.updateContent({
		        'element': window.parent.$('mainPanel'),
		        'loadMethod': 'iframe',
		        'url': 'mgfiles.aspx?tid='+p1+'&eid='+p4+'&'+(new Date()).getTime(),
		        'title': '管理类 - 版图文件及外来文件列表',
		        'scrollbars': false,
		        'padding': { top: 0, right: 0, bottom: 0, left: 0 }
	        });
        }
        /*End:[#19]*/
    </script>
</body>
</html>
